package com.ouyy.volunteerservice.volunteer.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ouyy.volunteerservice.volunteer.domain.po.VolunteerActivities;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface VolunteerActivateMapper extends BaseMapper<VolunteerActivities> {
    @Select("SELECT service_category AS category, COUNT(*) AS count " +
            "FROM volunteer_activities " +
            "GROUP BY service_category " +
            "ORDER BY count DESC")
    List<Map<String, Object>> countActivitiesByCategory();


    @Select("SELECT MONTH(start_date) AS month, COUNT(*) AS count " +
            "FROM volunteer_activities " +
            "GROUP BY MONTH(start_date) " +
            "ORDER BY month DESC")
    List<Map<String, Object>> countActivitiesByMonth();


}
